/*
 * @Author: chunlai
 * @Date: 2025-03-12 11:46:43
 * @LastEditTime: 2025-08-21 14:08:53
 * @LastEditors: minsheng_insurance_agency_zhoucl
 * @FilePath: \02.bldinsure\src\config\mapping.js
 * @Description: 常量映射表
 */
// 定义常量
const addr_type_keys = {
  RGT_NAME: "rgtName",
  AREA_NAME: "areaName",
  HOUSE_AREA_NAME: "houseAreaName",
  POSTAL_AREA_NAME: "postalAreaName",
  HOME_AREA_NAME: "homeAreaName",
};
// 映射表
export const addrKeyMapping = {
  [addr_type_keys.RGT_NAME]: {
    rgtAreaName: "addressDetail",
    rgtCity: "cityCode",
    rgtCounty: "countyCode",
    rgtProvince: "provinceCode",
    rgtZipCode: "zipCode",
  },
  [addr_type_keys.AREA_NAME]: {
    province: "provinceCode",
    provinceName: "provinceName",
    city: "cityCode",
    cityName: "cityName",
    county: "countyCode",
    countyName: "countyName",
    areaName: "addressDetail", //通讯地址 省+市+县
    zipCode: "zipCode",
    townName: "townName",
    townNo: "townNo",
    town: "townNo", // 新接口townNo改为town
  },
  [addr_type_keys.HOUSE_AREA_NAME]: {
    province: "provinceCode",
    provinceName: "provinceName",
    city: "cityCode",
    cityName: "cityName",
    county: "countyCode",
    countyName: "countyName",
    houseAreaName: "addressDetail",
  },
  [addr_type_keys.POSTAL_AREA_NAME]: {
    postalProvince: "provinceCode",
    postalProvinceName: "provinceName",
    postalCity: "cityCode",
    postalCityName: "cityName",
    postalCounty: "countyCode",
    postalCountyName: "countyName",
    postalAreaName: "addressDetail", //通讯地址 省+市+县
    postalZipCode: "zipCode",
    postalTownName: "townName",
    postalTown: "townNo",
  },
  [addr_type_keys.HOME_AREA_NAME]: {
    homeProvince: "provinceCode",
    homeProvinceName: "provinceName",
    homeCity: "cityCode",
    homeCityName: "cityName",
    homeCounty: "countyCode",
    homeCountyName: "countyName",
    homeAreaName: "addressDetail", //通讯地址 省+市+县
    homeTownName: "townName",
    homeTown: "townNo",
  },
};

export const key2Mapping = {
  idType: ["idType", "idName"],
  holderType: ["holderType", "holderTypeName"],
  sex: ["sex", "sexName"],
  socialSecFlag: ["socialSecFlag", "socialSecFlagName"],
  nationality: ["nationality", "nationalityName"],
  maritalStatus: ["maritalStatus", "maritalStatusName"],
  degree: ["degree", "degreeName"],
  residentType: ["residentType", "residentTypeName"],
  crsIdType: ["crsIdType", "crsIdTypeName"],
  relationToAppnt: ["relationToAppnt", "relationToAppntName"],
  guardianRelationToInsured: [
    "guardianRelationToInsured",
    "guardianRelationToInsuredName",
  ],
  relationToInsured: ["relationToInsured", "relationToInsuredName"],
  relationToMain: ["relationToMain", "relationToMainName"],
  housesEquity: ["housesEquity", "housesEquityName"],
};

// 数据库不保存的区域中文回显
export const areaCodesMapping = [
  "postalProvince",
  "postalCity",
  "postalCounty",
  "homeProvince",
  "homeCity",
  "homeCounty",
  "province",
  "city",
  "county",
];

// 查询接口返回字段名称映射
export const keyNameListMapping = {
  degree: ["degreeName", "degreeList"],
  idType: ["idName", "idTypeList"],
  maritalStatus: ["maritalStatusName", "maritalStatusList"],
  nationality: ["nationalityName", "nationList"],
};
